#ifndef __APDUPARSE_H__
#define __APDUPARSE_H__


	#define H1			0UL
	#define H2			1UL
	#define H3			2UL
	#define H4			3UL
	
	#define B1			4UL
	#define B2			5UL
	#define B3			6UL
	#define B4			7UL
	
	#define MODE_NONE	0	
	#define MODE_1		1	
	#define MODE_2S		2
	#define MODE_2E		3	
	#define MODE_3S		4
	#define MODE_3E		5	
	#define MODE_4S		6
	#define MODE_4E		7
	
	typedef struct
	{
		UINT8 CLA;
		UINT8 INS;
		UINT8 P1;
		UINT8 P2;
		UINT16 LC;
		UINT16 LE;
		UINT8 *pData;
		UINT8 *pBuf;
		UINT8 Mode;
		UINT32 Counter;
	}ApduCmd;
	
	typedef struct
	{
		UINT8 *pData;
		UINT16 Len;
	}ApduRsp;
	
	extern UINT32 APDU_Decoding(UINT8 *pBuffer, UINT32 nLen);
	extern void APDU_SetRespond(UINT32 nDatasLen, UINT16 nSw);
	extern ApduCmd *APDU_GetCmd(void);
	extern ApduRsp *APDU_GetRsp(void);

#endif
